load("@rules_cc//cc:defs.bzl", "cc_binary")

package(default_visibility = ["//visibility:public"])

cc_binary(
    name = "bsdtar",
    srcs = [
        "bsdtar.c",
        "bsdtar.h",
        "bsdtar_platform.h",
        "cmdline.c",
        "creation_set.c",
        "read.c",
        "subst.c",
        "util.c",
        "write.c",
    ] + select({
        "@platforms//os:windows": [
            "bsdtar_windows.c",
            "bsdtar_windows.h",
        ],
        "//conditions:default": [],
    }),
    deps = [
        "//libarchive",
        "//libarchive_fe",
    ],
)

alias(
    name = "tar",
    actual = ":bsdtar",
)
